import { baseUrlApi } from "./utils";
import axios from 'axios'

import { http } from "@/utils/http";

export const service = axios.create({
  baseURL: import.meta.env.VITE_UPLOAD
})


export const uploadUrl = baseUrlApi("/api/file/upload")

// 图片预览--无权限
export const getPicImg = (fileid: string) => {
  return `${import.meta.env.VITE_UPLOAD}/api/file/getpic/${fileid}`
};

// 无需登录pdf预览，文件下载，软件下载
export const geturlneeddl = (fileid: string) => {
  // return `${import.meta.env.VITE_UPLOAD}/api/file/geturlneeddl/${fileid}`
  return `${import.meta.env.VITE_UPLOAD}/api/file/geturl1/${fileid}`
};


/** 图片预览--无权限 */
export const getimgdata = (id) => {
  return http.request("get", baseUrlApi(`/api/file/getpic/${id}`));
};

export const uploadFile = (data?: object) => {
  return http.request("post", baseUrlApi(`/api/file/upload`), data);
};
